package plus.easydo.xxl.job.request;

import plus.easydo.xxl.job.model.ExecutorInfo;
import plus.easydo.xxl.job.model.SchedulerInfo;
import plus.easydo.xxl.job.model.TriggerScheduler;

import java.util.List;

/**
 * @author yuzhanfeng
 * @Date 2023/2/16 16:31
 * @Description 抽象xxl-job请求接口
 */
public interface XxlJobRequest {


    /**
     * 获取cookie
     *
     * @return java.lang.String
     * @author laoyu
     * @date 2023/2/16
     */
    String login();

    /**
     * 获取cookie
     *
     * @param address address
     * @param username username
     * @param password password
     * @return java.lang.String
     * @author laoyu
     * @date 2023/2/16
     */
    String login(String address, String username, String password);


    /**
     * 获取执行器列表
     *
     * @return java.util.List<com.yunli.govaffair.xxl.job.model.ExecutorInfo>
     * @author laoyu
     * @date 2023/2/16
     */
    List<ExecutorInfo> executorList();

    /**
     * 获取执行器列表
     *
     * @param cookie cookie
     * @param address address
     * @param appname appname
     * @return java.util.List<com.yunli.govaffair.xxl.job.model.ExecutorInfo>
     * @author laoyu
     * @date 2023/2/16
     */
    List<ExecutorInfo> executorList(String cookie, String address, String appname);

    /**
     * 注册执行器
     *
     * @return void
     * @author laoyu
     * @date 2023/2/16
     */
    String executorRegister();

    /**
     * 注册执行器
     *
     * @param cookie cookie
     * @param address address
     * @param executorInfo executorInfo
     * @return void
     * @author laoyu
     * @date 2023/2/16
     */
    String executorRegister(String cookie, String address, ExecutorInfo executorInfo);

    /**
     * 调度任务列表
     *
     * @param jobGroup jobGroup
     * @return java.util.List<com.yunli.govaffair.xxl.job.model.SchedulerInfo>
     * @author laoyu
     * @date 2023/2/16
     */
    List<SchedulerInfo> schedulerList(Integer jobGroup);

    /**
     * 调度任务列表
     *
     * @param cookie cookie
     * @param address address
     * @param jobGroup jobGroup
     * @return java.util.List<com.yunli.govaffair.xxl.job.model.SchedulerInfo>
     * @author laoyu
     * @date 2023/2/16
     */
    List<SchedulerInfo> schedulerList(String cookie, String address, Integer jobGroup);

    /**
     * 调度任务注册
     *
     * @param schedulerInfo schedulerInfo
     * @return java.lang.String
     * @author laoyu
     * @date 2023/2/17
     */
    String schedulerRegister(SchedulerInfo schedulerInfo);

    /**
     * 调度任务注册
     *
     * @param cookie cookie
     * @param address address
     * @param schedulerInfo schedulerInfo
     * @return java.lang.String
     * @author laoyu
     * @date 2023/2/17
     */
    String schedulerRegister(String cookie, String address, SchedulerInfo schedulerInfo);

    /**
     * 更新调度任务
     *
     * @param schedulerInfo schedulerInfo
     * @author laoyu
     * @date 2023/2/17
     */
    void schedulerUpdate(SchedulerInfo schedulerInfo);

    /**
     * 更新调度任务
     *
     * @param cookie cookie
     * @param address address
     * @param schedulerInfo schedulerInfo
     * @author laoyu
     * @date 2023/2/17
     */
    void schedulerUpdate(String cookie, String address, SchedulerInfo schedulerInfo);


    /**
     * 删除调度任务
     *
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void removeScheduler(String id);

    /**
     * 删除调度任务
     *
     * @param cookie cookie
     * @param address address
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void removeScheduler(String cookie, String address, String id);

    /**
     * 启动调度任务
     *
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void startScheduler(String id);

    /**
     * 启动调度任务
     *
     * @param cookie cookie
     * @param address address
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void startScheduler(String cookie, String address, String id);


    /**
     * 停止调度任务
     *
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void stopScheduler(String id);

    /**
     * 停止调度任务
     *
     * @param cookie cookie
     * @param address address
     * @param id id
     * @author laoyu
     * @date 2023/2/17
     */
    void stopScheduler(String cookie, String address, String id);

    /**
     * 触发调度任务
     *
     * @param triggerScheduler triggerScheduler
     * @author laoyu
     * @date 2023/2/17
     */
    void triggerScheduler(TriggerScheduler triggerScheduler);

    /**
     * 触发调度任务
     *
     * @param cookie cookie
     * @param address address
     * @param triggerScheduler triggerScheduler
     * @author laoyu
     * @date 2023/2/17
     */
    void triggerScheduler(String cookie, String address, TriggerScheduler triggerScheduler);

}
